package com.gitee.ywj1352.learning.ag.uc.biz;

import com.gitee.ywj1352.learning.ag.uc.entity.BaseUser;
import com.gitee.ywj1352.learning.ag.uc.mapper.BaseUserMapper;
import com.gitee.ywj1352.lerning.ag.common.biz.BaseBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by ywj on 2018/2/7.
 */
@Service
public class BaseUserBiz extends BaseBiz<BaseUserMapper,BaseUser> {

    @Autowired
    private BaseUserMapper baseUserMapper;

    public int deleteByPrimaryKey(Object o) {
        return baseUserMapper.deleteByPrimaryKey(o);
    }

    @Transactional(rollbackFor = Exception.class)
    public void insert(BaseUser baseUser) {
        BaseUser baseUser1 = new BaseUser();
        baseUser1.setId(1L);
        baseUser1.setName("shsha");
        baseUser1.setAge(33);

        baseUserMapper.updateByPrimaryKey(baseUser1);
       // int i= 10/0;
       // System.out.println(i);
        baseUserMapper.insert(baseUser);
    }


    public List<BaseUser> selectAll() {
        return baseUserMapper.selectAll();
    }

    public BaseUser selectByPrimaryKey(Object o) {
        return baseUserMapper.selectByPrimaryKey(o);
    }


    public BaseUser selectOne(BaseUser baseUser) {
        return baseUserMapper.selectOne(baseUser);
    }

    public int updateByPrimaryKey(BaseUser baseUser) {
        return baseUserMapper.updateByPrimaryKey(baseUser);
    }
}
